

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>现有集群切换到 cephadm &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Host Management" href="../host-management/" />
    <link rel="prev" title="部署个全新的 Ceph 集群" href="../install/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Cephadm</a></li>
      <li class="breadcrumb-item active">现有集群切换到 cephadm</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/cephadm/adoption.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Cephadm</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../compatibility/">Compatibility and Stability</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install/">部署个全新的 Ceph 集群</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">现有集群切换到 cephadm</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">局限性</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">准备工作</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adoption-process">Adoption process</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../host-management/">Host Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../services/">Service Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../certmgr/">Certificate Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../upgrade/">升级 Ceph</a></li>
<li class="toctree-l2"><a class="reference internal" href="../operations/">Cephadm operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../client-setup/">Client Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="../troubleshooting/">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/cephadm/">Cephadm Feature Planning</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="cephadm">
<span id="cephadm-adoption"></span><h1>现有集群切换到 cephadm<a class="headerlink" href="#cephadm" title="Permalink to this heading"></a></h1>
<p>把现有集群转交给 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 接管是可行的。
适用于之前用 <code class="docutils literal notranslate"><span class="pre">ceph-deploy</span></code> 、 <code class="docutils literal notranslate"><span class="pre">ceph-ansible</span></code> 、或 <code class="docutils literal notranslate"><span class="pre">DeepSea</span></code> 部署的集群。</p>
<p>这篇文档就解释了如何确定你的集群是否能转换成可以被 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 接管的状态，
以及如何执行那些转换步骤。</p>
<section id="id1">
<h2>局限性<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<ul class="simple">
<li><p>Cephadm 仅适配 BlueStore OSDs；集群内的 FileStore OSDs 不能用 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 管理。</p></li>
</ul>
</section>
<section id="id2">
<h2>准备工作<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<ol class="arabic">
<li><p>确保 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 命令行工具可以在现有集群内的各个主机上正常使用。
如何部署请参考 <a class="reference internal" href="../install/#get-cephadm"><span class="std std-ref">安装 cephadm</span></a> 。</p></li>
<li><p>Prepare each host for use by <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> by running this command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">cephadm<span class="w"> </span>prepare-host</span>
</pre></div></div></li>
<li><p>Choose a version of Ceph to use for the conversion. This procedure will work
with any release of Ceph that is Octopus (15.2.z) or later.  The
latest stable release of Ceph is the default. You might be upgrading from an
earlier Ceph release at the same time that you’re performing this
conversion.  If you are upgrading from an earlier release, make sure to
follow any upgrade-related instructions for that release.</p>
<p>Pass the Ceph container image to cephadm with the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm<span class="w"> </span>--image<span class="w"> </span><span class="nv">$IMAGE</span><span class="w"> </span>&lt;rest<span class="w"> </span>of<span class="w"> </span><span class="nb">command</span><span class="w"> </span>goes<span class="w"> </span>here&gt;</span>
</pre></div></div><p>The conversion begins.</p>
</li>
<li><p>Confirm that the conversion is underway by running <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">ls</span></code> and
making sure that the style of the daemons is changed:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm<span class="w"> </span>ls</span>
</pre></div></div><p>Before starting the conversion process, <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">ls</span></code> reports all existing
daemons with the style <code class="docutils literal notranslate"><span class="pre">legacy</span></code>. As the adoption process progresses,
adopted daemons will appear with the style <code class="docutils literal notranslate"><span class="pre">cephadm:v1</span></code>.</p>
</li>
</ol>
</section>
<section id="adoption-process">
<h2>Adoption process<a class="headerlink" href="#adoption-process" title="Permalink to this heading"></a></h2>
<ol class="arabic">
<li><p>Make sure that the ceph configuration has been migrated to use the cluster’s
central config database.  If <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code> is identical on all
hosts, then the following command can be run on one host and will take
effect for all hosts:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span>assimilate-conf<span class="w"> </span>-i<span class="w"> </span>/etc/ceph/ceph.conf</span>
</pre></div></div><p>If there are configuration variations between hosts, you will need to repeat
this command on each host, taking care that if there are conflicting option
settings across hosts, the values from the last host will be used. During this
adoption process, view the cluster’s central
configuration to confirm that it is complete by running the following
command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>config<span class="w"> </span>dump</span>
</pre></div></div></li>
<li><p>Adopt each Monitor:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm<span class="w"> </span>adopt<span class="w"> </span>--style<span class="w"> </span>legacy<span class="w"> </span>--name<span class="w"> </span>mon.&lt;hostname&gt;</span>
</pre></div></div><p>Each legacy Monitor will stop, quickly restart as a cephadm
container, and rejoin the quorum.</p>
</li>
<li><p>Adopt each Manager:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm<span class="w"> </span>adopt<span class="w"> </span>--style<span class="w"> </span>legacy<span class="w"> </span>--name<span class="w"> </span>mgr.&lt;hostname&gt;</span>
</pre></div></div></li>
<li><p>Enable cephadm orchestration:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mgr<span class="w"> </span>module<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>cephadm</span>
<span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span><span class="nb">set</span><span class="w"> </span>backend<span class="w"> </span>cephadm</span>
</pre></div></div></li>
<li><p>Generate an SSH key for cephadm:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>cephadm<span class="w"> </span>generate-key</span>
<span class="prompt1">ceph<span class="w"> </span>cephadm<span class="w"> </span>get-pub-key<span class="w"> </span>&gt;<span class="w"> </span>~/ceph.pub</span>
</pre></div></div></li>
<li><p>Install the cephadm SSH key on each host in the cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ssh-copy-id<span class="w"> </span>-f<span class="w"> </span>-i<span class="w"> </span>~/ceph.pub<span class="w"> </span>root@&lt;host&gt;</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is also possible to import an existing SSH key. See
<a class="reference internal" href="../troubleshooting/#cephadm-ssh-errors"><span class="std std-ref">SSH errors</span></a> in the troubleshooting
document for instructions that describe how to import existing
SSH keys.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is also possible to arrange for cephadm to use a non-root user to SSH
into cluster hosts. This user needs to have passwordless sudo access.
Use <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">cephadm</span> <span class="pre">set-user</span> <span class="pre">&lt;user&gt;</span></code> and copy the SSH key to that user’s
home directory on each host.
See <a class="reference internal" href="../host-management/#cephadm-ssh-user"><span class="std std-ref">Configuring a different SSH user</span></a></p>
</div>
</li>
<li><p>Tell cephadm which hosts to manage:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>host<span class="w"> </span>add<span class="w"> </span>&lt;hostname&gt;<span class="w"> </span><span class="o">[</span>ip-address<span class="o">]</span></span>
</pre></div></div><p>This will run <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">check-host</span></code> on each host before adding it.
This check ensures that the host is functioning properly. The IP address
argument is recommended. If the address is not provided, then the host name
will be resolved via DNS.</p>
</li>
<li><p>Verify that the adopted monitor and manager daemons are visible:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>ps</span>
</pre></div></div></li>
<li><p>Adopt all OSDs in the cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm<span class="w"> </span>adopt<span class="w"> </span>--style<span class="w"> </span>legacy<span class="w"> </span>--name<span class="w"> </span>&lt;name&gt;</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm<span class="w"> </span>adopt<span class="w"> </span>--style<span class="w"> </span>legacy<span class="w"> </span>--name<span class="w"> </span>osd.1</span>
<span class="prompt1">cephadm<span class="w"> </span>adopt<span class="w"> </span>--style<span class="w"> </span>legacy<span class="w"> </span>--name<span class="w"> </span>osd.2</span>
</pre></div></div></li>
<li><p>Redeploy CephFS MDS daemons (if deployed) by telling cephadm how many daemons to run for
each file system. List CephFS file systems by name with the command <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">fs</span>
<span class="pre">ls</span></code>. Run the following command on the master nodes to redeploy the MDS
daemons:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>mds<span class="w"> </span>&lt;fs-name&gt;<span class="w"> </span><span class="o">[</span>--placement<span class="o">=</span>&lt;placement&gt;<span class="o">]</span></span>
</pre></div></div><p>For example, in a cluster with a single file system called <cite>foo</cite>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>ls</span>
</pre></div></div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>name:<span class="w"> </span>foo,<span class="w"> </span>metadata<span class="w"> </span>pool:<span class="w"> </span>foo_metadata,<span class="w"> </span>data<span class="w"> </span>pools:<span class="w"> </span><span class="o">[</span>foo_data<span class="w"> </span><span class="o">]</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>mds<span class="w"> </span>foo<span class="w"> </span><span class="m">2</span></span>
</pre></div></div><p>Confirm that the new MDS daemons have started:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>ps<span class="w"> </span>--daemon-type<span class="w"> </span>mds</span>
</pre></div></div><p>Finally, stop and remove the legacy MDS daemons:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>stop<span class="w"> </span>ceph-mds.target</span>
<span class="prompt1">rm<span class="w"> </span>-rf<span class="w"> </span>/var/lib/ceph/mds/ceph-*</span>
</pre></div></div></li>
<li><p>Redeploy Ceph Object Gateway RGW daemons if deployed. Cephadm manages RGW
daemons by zone. For each zone, deploy new RGW daemons with cephadm:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>rgw<span class="w"> </span>&lt;svc_id&gt;<span class="w"> </span><span class="o">[</span>--realm<span class="o">=</span>&lt;realm&gt;<span class="o">]</span><span class="w"> </span><span class="o">[</span>--zone<span class="o">=</span>&lt;zone&gt;<span class="o">]</span><span class="w"> </span><span class="o">[</span>--port<span class="o">=</span>&lt;port&gt;<span class="o">]</span><span class="w"> </span><span class="o">[</span>--ssl<span class="o">]</span><span class="w"> </span><span class="o">[</span>--placement<span class="o">=</span>&lt;placement&gt;<span class="o">]</span></span>
</pre></div></div><p>where <em>&lt;placement&gt;</em> can be a simple daemon count, or a list of
specific hosts (see <a class="reference internal" href="../services/#orchestrator-cli-placement-spec"><span class="std std-ref">Daemon Placement</span></a>). The
zone and realm arguments are needed only for a multisite setup.</p>
<p>After the daemons have started and you have confirmed that they are
functioning, stop and remove the legacy daemons:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>stop<span class="w"> </span>ceph-rgw.target</span>
<span class="prompt1">rm<span class="w"> </span>-rf<span class="w"> </span>/var/lib/ceph/radosgw/ceph-*</span>
</pre></div></div></li>
<li><p>Check the output of the command <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">health</span> <span class="pre">detail</span></code> for cephadm warnings
about stray cluster daemons or hosts that are not yet managed by cephadm.</p></li>
</ol>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../install/" class="btn btn-neutral float-left" title="部署个全新的 Ceph 集群" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../host-management/" class="btn btn-neutral float-right" title="Host Management" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>